#ifndef C_STEREO_CAMERA_H
#define C_STEREO_CAMERA_H 1

#include "CCamera.h"
#include "cvxCapture.h"

class CStereoCamera
{
public:
	CStereoCamera();
	~CStereoCamera();

	//computer Euler angle and translation vector 
	static void GetRotateTranslation(Mat& leftCameraMatrix, Mat& leftDistCoeffs, 
									 Mat& rightCameraMatrix, Mat& rightDistCoeffs,
									 const vector<Point3f> &objectPoints,
									 const vector<Point2f>& leftImagePoints, 
									 const vector<Point2f>& rightImagePoints,
									 const CvSize &imageSize,
									 float &thetaX, float &thetaY, float &thetaZ, Mat &tanslation);
	
	
	//align two images seperatelly
	static double AlignTwoImages(Mat& leftCameraMatrix, Mat& leftDistCoeffs, 
							    Mat& rightCameraMatrix, Mat& rightDistCoeffs,
								const vector<Point3f> &objectPoints,
								const vector<Point2f>& leftImagePoints, 
								const vector<Point2f>& rightImagePoints,
							    IplImage *leftImage, IplImage *rightImage, IplImage *alignLeft, IplImage *alignRight,
								double alpha);

	static void AlignImageSequence(Mat& leftCameraMatrix, Mat& leftDistCoeffs, 
								Mat& rightCameraMatrix, Mat& rightDistCoeffs,
								const vector<Point3f> &objectPoints,
								const vector<vector<Point2f>>& leftImagePoints, 
								const vector<vector<Point2f>>& rightImagePoints,
								const CvSize &imgSize,
								double alpha, Mat rmap[][2]);


private:
	CCamera m_leftCamera;    //left camera
	CCamera m_rightCamera;   //right camera

	Mat m_rotateMatrix;
	Mat m_translationMatrix;
	Mat m_essentialMatrix;
	Mat m_fundamentalMatrix;

};

#endif